import os, sys

try:
	import pygtk
	pygtk.require ("2.0")
	import gtk
	import gobject
except:
	sys.exit (1)

import smartglade

class window1(smartglade.xml_new_from_buffer):
	def __init__(self):
		glade_buffer = '''
			<glade-interface>
				<widget class="GtkWindow" id="window1">
					<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
					<child>
						<widget class="GtkHBox" id="hbox1">
							<property name="visible">True</property>
							<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
							<child>
								<widget class="GtkLabel" id="label1">
									<property name="visible">True</property>
									<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
									<property name="label" translatable="yes">Your Name</property>
								</widget>
								<packing>
									<property name="expand">False</property>
								</packing>
							</child>
							<child>
								<widget class="GtkEntry" id="entry1">
									<property name="visible">True</property>
									<property name="can_focus">True</property>
									<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
								</widget>
								<packing>
									<property name="position">1</property>
								</packing>
							</child>
							<child>
								<widget class="GtkButton" id="button1">
									<property name="visible">True</property>
									<property name="can_focus">True</property>
									<property name="receives_default">True</property>
									<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
									<property name="label" translatable="yes">gtk-ok</property>
									<property name="use_stock">True</property>
									<property name="response_id">0</property>
								</widget>
								<packing>
									<property name="expand">False</property>
									<property name="position">2</property>
								</packing>
							</child>
						</widget>
					</child>
				</widget>
			</glade-interface>
		'''
		
		smartglade.xml_new_from_buffer.__init__(self, glade_buffer)
		self.get('window1')
		self.window = self.window1
		
		self.window.connect("destroy", self.window_destroy)
		self.button1.connect ("clicked", self.button1_cb)
		
	def run(self):
		self.window.show_all()
		gtk.main()
	
	def window_destroy(self, *args):
		self.window.destroy()
		gtk.main_quit()
	
	def button1_cb(self, *args):
		self.window.destroy()

if __name__ == '__main__':
	window1().run()